package com.mdxx.xczd.api;

import com.mdxx.xczd.bean.AlarmBeanResult;
import com.mdxx.xczd.bean.AlarmStateResult;
import com.mdxx.xczd.bean.BarCodeBeanResult;
import com.mdxx.xczd.bean.BindStateResult;
import com.mdxx.xczd.bean.CancelAlarmResult;
import com.mdxx.xczd.bean.GetUserResult;
import com.mdxx.xczd.bean.SubmitFileResult;
import com.mdxx.xczd.bean.TaskBeanResult;
import com.mdxx.xczd.bean.UserBeanResult;
import com.mdxx.xczd.bean.VersionInfoResult;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Header;
import retrofit2.http.POST;
import rx.Observable;

/**
 * Created by MD-02 on 2017/1/13.
 */

public interface ApiService {

 /*注册设备*/
 @POST("AndroidTaskServlet?action=device")
 @FormUrlEncoded
 Observable<BarCodeBeanResult> getBarCodeData(
         @Field("imei") String imei, @Field("type") String type,
         @Field("model") String model, @Field("apkType") String apkType);

 /*设备*/
 @POST("AndroidDeviceServlet?action=bindState")
 @FormUrlEncoded
 Observable<BindStateResult> getBindState(@Field("imei") String imei);

 /*用户列表*/
 @POST("AndroidDeviceServlet?action=initLogin")
 @FormUrlEncoded
 Observable<GetUserResult> getUserList(@Field("imei") String imei);

 /*登陆*/
 @POST("AndroidDeviceServlet?action=login")
 @FormUrlEncoded
 Observable<UserBeanResult> login(
         @Header("imei") String imei, @Header("empNum") String empNum,
         @Field("empNum") String username, @Field("empPwd") String password);

 /* 测试*/
 @POST("AndroidDeviceServlet?action=login")
 @FormUrlEncoded
 Call<UserBeanResult> login1(
         @Header("imei") String imei, @Header("empNum") String empNum,
         @Field("userName") String username, @Field("password") String password);

 /*任务列表*/
 @POST("AndroidTaskServlet?action=getEmpTaskList")
 @FormUrlEncoded
 Observable<TaskBeanResult> getTaskList(@Field("empNum") String username);

 /*上传文件*/
 @POST("MediaServlet?action=upload")
 Observable<SubmitFileResult> submitFile(@Body RequestBody Body);

 /*上传视频*/
 @POST("MediaServlet?action=upload")
 Observable<SubmitFileResult> submitVideo(@Body RequestBody Body);

 /*报警*/
 @POST("AndroidTaskServlet?action=addAlarm")
 @FormUrlEncoded
 Observable<AlarmBeanResult> sendAlarm(@Field("alarm") String alarm);

 /*上传位置信息*/
 @POST("AndroidTaskServlet?action=location")
 @FormUrlEncoded
 Observable<TaskBeanResult> submitLocation(@Field("params") String params);

 /*保护点点完成*/
 @POST("AndroidTaskServlet?action=patrol")
 @FormUrlEncoded
 Observable<TaskBeanResult> submitFinishedPoint(
         @Field("taskNum") String taskNum,
         @Field("siteNum") String siteNum,
         @Field("patrolTime") String patrolTime);

 /*保护点点完成*/
 @POST("AndroidDeviceServlet?action=checkAPKVersion")
 @FormUrlEncoded
 Observable<VersionInfoResult> updateVersion(@Field("apkType") String general);

 /*保护点点完成*/
 @POST("AndroidTaskServlet?action=alarmState")
 @FormUrlEncoded
 Observable<AlarmStateResult> getAlarmState(@Field("empNum") String empNum);


 /*取消报警*/
 @POST("AndroidTaskServlet?action=endAlarm")
 @FormUrlEncoded
 Observable<CancelAlarmResult> cancelAlarm(@Field("alarmNum") String alarmNum);
}
